using System;
using System.Data;
using PCSComUtils.PCSExc;
using PCSComProduct.Items.DS;
using PCSComProduct.Costing.DS;
using PCSComUtils.MasterSetup.DS;
namespace PCSComProduct.Items.BO
{
	public class ItemCostMaintenanceBO //: IItemCostMaintenanceBO
	{
		private const string THIS = "PCSComProduct.Items.BO.ItemCostMaintenanceBO";
		public ItemCostMaintenanceBO()
		{
			//
			// TODO: Add constructor logic here
			//
		}


	
		public void Add(object pObjectDetail)
		{
			// TODO:  Add ItemCostMaintenanceBO.Add implementation

		}
	
		public void Delete(object pObjectVO)
		{
			// TODO:  Add ItemCostMaintenanceBO.Delete implementation

		}
	
		public object GetObjectVO(int pintID, string VOclass)
		{
			// TODO:  Add ItemCostMaintenanceBO.GetObjectVO implementation
			return null;
		}
	
		public void Update(object pObjectDetail)
		{
			// TODO:  Add ItemCostMaintenanceBO.Update implementation

		}
	
		public void UpdateDataSet(DataSet dstData)
		{
			// TODO:  Add ItemCostMaintenanceBO.UpdateDataSet implementation

		}
		//**************************************************************************              
		///    <Description>
		///       Return a list of cost center
		///    </Description>
		///    <Inputs>
		///       
		///    </Inputs>
		///    <Outputs>
		///       
		///    </Outputs>
		///    <Returns>
		///       
		///    </Returns>
		///    <Authors>
		///       THIENHD
		///    </Authors>
		///    <History>
		///       15-Dec-2004
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		//[AutoComplete(true)]
		public DataTable ListCostCenter()
		{
			try 
			{
				ITM_CostCenterDS objITM_CostCenterDS = new ITM_CostCenterDS();
				return objITM_CostCenterDS.List().Tables[0];
			}
			catch (PCSDBException ex) 
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		//**************************************************************************              
		///    <Description>
		///       Return a list of cost detail
		///    </Description>
		///    <Inputs>
		///       
		///    </Inputs>
		///    <Outputs>
		///       
		///    </Outputs>
		///    <Returns>
		///       
		///    </Returns>
		///    <Authors>
		///       THIENHD
		///    </Authors>
		///    <History>
		///       15-Dec-2004
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		//[AutoComplete(true)]
		public DataTable GetListOfCostDetail(int pintProductID, int pintCCNID)
		{
			try 
			{
				ITM_CostOperationDS objITM_CostOperationDS = new ITM_CostOperationDS();
				return objITM_CostOperationDS.GetCostItemMaintenance(pintProductID, pintCCNID);
			}
			catch (PCSDBException ex) 
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		//**************************************************************************              
		///    <Description>
		///       Get unit of measure code from id
		///    </Description>
		///    <Inputs>
		///       
		///    </Inputs>
		///    <Outputs>
		///       
		///    </Outputs>
		///    <Returns>
		///       
		///    </Returns>
		///    <Authors>
		///       THIENHD
		///    </Authors>
		///    <History>
		///       15-Dec-2004
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		//[AutoComplete(true)]
		public string GetUnitCodeFromID(int pintUnitID)
		{
			try 
			{
				MST_UnitOfMeasureDS objMST_UnitOfMeasureDS = new MST_UnitOfMeasureDS();
				MST_UnitOfMeasureVO objMST_UnitOfMeasureVO = (MST_UnitOfMeasureVO)objMST_UnitOfMeasureDS.GetObjectVO(pintUnitID);
				return objMST_UnitOfMeasureVO.Code;
			}
			catch (PCSDBException ex) 
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		//**************************************************************************              
		///    <Description>
		///       Return the information for the cost item
		///    </Description>
		///    <Inputs>
		///       
		///    </Inputs>
		///    <Outputs>
		///       
		///    </Outputs>
		///    <Returns>
		///       
		///    </Returns>
		///    <Authors>
		///       THIENHD
		///    </Authors>
		///    <History>
		///       15-Dec-2004
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		//[AutoComplete(true)]
		public DataTable GetItemCostDescription(int pintProductID, int pintCCNID)
		{
			try 
			{
				ITM_CostDS objITM_CostDS = new ITM_CostDS();
				return objITM_CostDS.GetCostItemMaintenanceDesc(pintProductID, pintCCNID);
			}
			catch (PCSDBException ex) 
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		//**************************************************************************              
		///    <Description>
		///       Update cost item
		///    </Description>
		///    <Inputs>
		///       
		///    </Inputs>
		///    <Outputs>
		///       
		///    </Outputs>
		///    <Returns>
		///       
		///    </Returns>
		///    <Authors>
		///       THIENHD
		///    </Authors>
		///    <History>
		///       15-Dec-2004
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		//[AutoComplete(true)]
		public void UpdateITMCost(ITM_CostVO pobjITM_CostVO, int pintCostCenterID)
		{
			try 
			{
				//Update the product table
				ITM_ProductDS objITM_ProductDS = new ITM_ProductDS();
				objITM_ProductDS.UpdateCostCenter(pobjITM_CostVO.ProductID,pintCostCenterID);

				//Update the ITM_Cost table
				ITM_CostDS objITM_CostDS = new ITM_CostDS();
				objITM_CostDS.UpdateItemCostMaintenance(pobjITM_CostVO);
			}
			catch (PCSDBException ex) 
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		//**************************************************************************              
		///    <Description>
		///       Get the product cost center
		///    </Description>
		///    <Inputs>
		///       
		///    </Inputs>
		///    <Outputs>
		///       
		///    </Outputs>
		///    <Returns>
		///       
		///    </Returns>
		///    <Authors>
		///       THIENHD
		///    </Authors>
		///    <History>
		///       15-Dec-2004
		///    </History>
		///    <Notes>
		///    </Notes>
		//**************************************************************************

		//[AutoComplete(true)]
		public DataRow GetProductCostCenter(int pintProductID)
		{
			try 
			{
				//Update the product table
				ITM_ProductDS objITM_ProductDS = new ITM_ProductDS();
				return objITM_ProductDS.GetProductCostCenter(pintProductID);
			}
			catch (PCSDBException ex) 
			{
				throw ex;
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}

	}
}
